<?php
if (!defined ('TYPO3_MODE')) {
	die ('Access denied.');
}

t3lib_extMgm::allowTableOnStandardPages('tx_zboard_topics');

$TCA['tx_zboard_topics'] = array (
	'ctrl' => array (
		'title'     => 'LLL:EXT:zboard/locallang_db.xml:tx_zboard_topics',
		'label'     => 'subject',
		'tstamp'    => 'tstamp',
		'crdate'    => 'crdate',
		'cruser_id' => 'cruser_id',
		'default_sortby' => 'ORDER BY crdate DESC',
		'delete' => 'deleted',
		'enablecolumns' => array (
			'disabled' => 'hidden',
		),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
		'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_zboard_topics.gif',
	),
);

$TCA['tx_zboard_replies'] = array (
	'ctrl' => array (
		'title'     => 'LLL:EXT:zboard/locallang_db.xml:tx_zboard_replies',
		'label'     => 'topic_id',
		'tstamp'    => 'tstamp',
		'crdate'    => 'crdate',
		'cruser_id' => 'cruser_id',
		'default_sortby' => 'ORDER BY crdate DESC',
		'delete' => 'deleted',
		'enablecolumns' => array (
			'disabled' => 'hidden',
		),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
		'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_zboard_replies.gif',
	),
);


t3lib_div::loadTCA('tt_content');
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi1']='layout,select_key';


t3lib_extMgm::addPlugin(array(
	'LLL:EXT:zboard/locallang_db.xml:tt_content.list_type_pi1',
	$_EXTKEY . '_pi1',
	t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'
),'list_type');


t3lib_div::loadTCA('tt_content');
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi2']='layout,select_key';


t3lib_extMgm::addPlugin(array(
	'LLL:EXT:zboard/locallang_db.xml:tt_content.list_type_pi2',
	$_EXTKEY . '_pi2',
	t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif'
),'list_type');

$tempColumns = array (
	'tx_zboard_topic_count' => array (
		'exclude' => 0,
		'label' => 'LLL:EXT:zboard/locallang_db.xml:pages.tx_zboard_topic_count',
		'config' => array (
			'type' => 'input',
			'size' => '30',
			'eval' => 'int',
		)
	),
	'tx_zboard_reply_count' => array (
		'exclude' => 0,
		'label' => 'LLL:EXT:zboard/locallang_db.xml:pages.tx_zboard_reply_count',
		'config' => array (
			'type' => 'input',
			'size' => '30',
			'eval' => 'int',
		)
	),
	'tx_zboard_last_post_tstamp' => array (
		'exclude' => 0,
		'label' => 'LLL:EXT:zboard/locallang_db.xml:pages.tx_zboard_last_post_tstamp',
		'config' => array (
			'type'     => 'input',
			'size'     => '12',
			'max'      => '20',
			'eval'     => 'datetime',
			'checkbox' => '0',
			'default'  => '0'
		)
	),
	'tx_zboard_last_post_user_id' => array (
		'exclude' => 0,
		'label' => 'LLL:EXT:zboard/locallang_db.xml:pages.tx_zboard_last_post_user_id',
		'config' => array (
			'type' => 'group',
			'internal_type' => 'db',
			'allowed' => 'fe_users',
			'size' => 1,
			'minitems' => 0,
			'maxitems' => 1,
		)
	),
);


t3lib_div::loadTCA('pages');
t3lib_extMgm::addTCAcolumns('pages',$tempColumns,1);
t3lib_extMgm::addToAllTCAtypes('pages','tx_zboard_topic_count;;;;1-1-1, tx_zboard_reply_count, tx_zboard_last_post_tstamp, tx_zboard_last_post_user_id');

$tempColumns = array (
	'tx_zboard_topic_count' => array (
		'exclude' => 0,
		'label' => 'LLL:EXT:zboard/locallang_db.xml:fe_users.tx_zboard_topic_count',
		'config' => array (
			'type' => 'input',
			'size' => '30',
			'eval' => 'int',
		)
	),
	'tx_zboard_reply_count' => array (
		'exclude' => 0,
		'label' => 'LLL:EXT:zboard/locallang_db.xml:fe_users.tx_zboard_reply_count',
		'config' => array (
			'type' => 'input',
			'size' => '30',
			'range' => array ('lower'=>0,'upper'=>1000),
			'eval' => 'int',
		)
	),
);


t3lib_div::loadTCA('fe_users');
t3lib_extMgm::addTCAcolumns('fe_users',$tempColumns,1);
t3lib_extMgm::addToAllTCAtypes('fe_users','tx_zboard_topic_count;;;;1-1-1, tx_zboard_reply_count');

require(t3lib_extMgm::extPath('zboard').'ext_tables_override.php');

?>